#想要获取指定贴吧中的指定页数内容
#导模块
import requests
#确定url
url = 'https://tieba.baidu.com/f'
#构造请求头
headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
                      'AppleWebKit/537.36 (KHTML, like Gecko) '
                      'Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43'}
params={
    'kw':'北京国安',
    'pn':150
}
#发送请求
response=requests.get(url,params=params,headers=headers)

with open('北京国安.html','w',encoding='utf8') as file_build:
    file_build.write(response.content.decode())

